const transformDict = (source: { label: string; value: any }[]) => {
    return source.map(item => ({
        ...item,
        text: item.label
    }));
};

export const CAR_TYPES = transformDict([
    { label: "临时车", value: 0 },
    { label: "月卡车", value: 1 },
    { label: "贵宾车", value: 2 },
    { label: "警车", value: 3 },
]);

export const BILLING_METHODS = transformDict([
    { label: '按小时计费', value: 'hourly' },
    { label: '按天计费', value: 'daily' },
    { label: '按月计费', value: 'monthly' },
]);

export const PARKING_SPACE_TYPE = transformDict([
    { label: "临时停车", value: 0 },
    { label: "固定停车", value: 1 },
]);

export const COMMON_YES_NO = transformDict([
    { label: "否", value: 0 },
    { label: "是", value: 1 },
]);

export const COUPON_TYPE = transformDict([
    { label: "时间减免", value: 0 },
    { label: "折扣减免", value: 1 },
    { label: "特定收费券", value: 2 },
    { label: "多次进出减免", value: 2 },
]);

export const COUPON_UNITS = transformDict([
    { label: "分钟", value: 0 },
    { label: "小时", value: 1 },
    { label: "天", value: 2 } 
]); 

export const DISCOUNT_AMOUNT = transformDict(Array.from({ length: 10 }, (_, i) => ({ label: (i + 1) * 10, value: (i + 1) * 10 })));

export const FULL_EXEMPTION_TYPE = transformDict([
    { label: "否", value: 0 },
    { label: "固定金额全免", value: 1 },
]);

export const FIXED_CODE = transformDict([
    { label: "使用", value: 1 },
    { label: "不使用", value: 0 },
]);

export const LIMIT_TIME = transformDict([
    { label: "无限制", value: 0 },
    { label: "每小时", value: 1 },
    { label: "每天", value: 2 },
    { label: "每月", value: 3 },
    { label: "每季", value: 4 },
    { label: "每年", value: 5 },
]);

export const CARD_TYPES = transformDict([
    { label: "临时车", value: 0 },
    { label: "月卡车", value: 1 },
    { label: "贵宾车", value: 2 },
    { label: "警车", value: 3 },
]);

export const DICT_LIST = [
    { type: 'CAR_TYPES', data: CAR_TYPES },
    { type: 'BILLING_METHODS', data: BILLING_METHODS },
    { type: 'PARKING_SPACE_TYPE', data: PARKING_SPACE_TYPE },
    { type: 'COMMON_YES_NO', data: COMMON_YES_NO },
    { type: 'COUPON_TYPE', data: COUPON_TYPE },
    { type: 'COUPON_UNITS', data: COUPON_UNITS },
    { type: 'DISCOUNT_AMOUNT', data: DISCOUNT_AMOUNT },
    { type: 'FULL_EXEMPTION_TYPE', data: FULL_EXEMPTION_TYPE },
    { type: 'FIXED_CODE', data: FIXED_CODE },
    { type: 'LIMIT_TIME', data: LIMIT_TIME },
    { type: 'CARD_TYPES', data: CARD_TYPES },
];
